Make gtk_printer_get_capabilities public, and move the
authorChristian Persch <chpe@gnome.org>
Mon, 30 Apr 2007 19:12:00 +0000 (19:12 +0000)
committerChristian Persch <chpe@src.gnome.org>
Mon, 30 Apr 2007 19:12:00 +0000 (19:12 +0000)
2007-04-30  Christian Persch  <chpe@gnome.org>

* docs/reference/gtk/gtk-sections.txt:
* gtk/gtk.symbols:
* gtk/gtkprinter-private.h:
* gtk/gtkprinter.c: (gtk_printer_get_capabilities),
(gtk_print_capabilities_get_type):
* gtk/gtkprinter.h:
* gtk/gtkprintunixdialog.c: (selected_printer_changed):
Make gtk_printer_get_capabilities public, and move the
GtkPrintCapabilities definition to gtkprinter.h. Bug #390437.

svn path=/trunk/; revision=17746

ChangeLog
docs/reference/gtk/gtk-sections.txt
gtk/gtk.symbols
gtk/gtkprinter-private.h
gtk/gtkprinter.c
gtk/gtkprinter.h
gtk/gtkprintunixdialog.c

index 2fd4c94569c465b5638a491ba4a154eba8023518..5b900a606fd7880c0975b6d5ae305cfed417224a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-04-30  Christian Persch  <chpe@gnome.org>
+
+       * docs/reference/gtk/gtk-sections.txt:
+       * gtk/gtk.symbols:
+       * gtk/gtkprinter-private.h:
+       * gtk/gtkprinter.c: (gtk_printer_get_capabilities),
+       (gtk_print_capabilities_get_type):
+       * gtk/gtkprinter.h:
+       * gtk/gtkprintunixdialog.c: (selected_printer_changed):
+       Make gtk_printer_get_capabilities public, and move the
+       GtkPrintCapabilities definition to gtkprinter.h. Bug #390437.
+
 2007-04-30  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkexpander.c (gtk_expander_realize): A NO_WINDOW widget
index df1856b0040bc7f01145e9879a1af731d89e8c14..2b8f6796a52c32da595d4ee6a8c5decd8e34555b 100644 (file)
@@ -6216,6 +6216,7 @@ gtk_printer_list_papers
 gtk_printer_compare
 gtk_printer_has_details
 gtk_printer_request_details
+gtk_printer_get_capabilities
 GtkPrinterFunc
 gtk_enumerate_printers
 
index 43b74b5b0f122b4892b7745a53355253d88abad8..73b9546ca9d983633a05968b3dbc945bc62f9be3 100644 (file)
@@ -2629,7 +2629,9 @@ gtk_printer_accepts_ps
 gtk_printer_compare
 gtk_printer_has_details
 gtk_printer_request_details
+gtk_printer_get_capabilities
 gtk_enumerate_printers
+gtk_print_capabilities_get_type G_GNUC_CONST
 #endif
 #endif
 #endif
@@ -2714,7 +2716,6 @@ gtk_print_job_get_surface
 gtk_print_job_send
 gtk_print_job_set_track_print_status
 gtk_print_job_get_track_print_status
-gtk_print_capabilities_get_type G_GNUC_CONST
 #endif
 #endif
 #endif
index 6bedb63c26d2a21b703eba8b274fbba3ea6eb8f9..26146a10a6dbb4816feecb2b0cf2e6e86f9634db 100644 (file)
@@ -54,8 +54,6 @@ void                 _gtk_printer_get_hard_margins          (GtkPrinter
                                                             gdouble             *left,
                                                             gdouble             *right);
 GHashTable *         _gtk_printer_get_custom_widgets        (GtkPrinter          *printer);
-GtkPrintCapabilities _gtk_printer_get_capabilities          (GtkPrinter          *printer);
-
 
 /* GtkPrintJob private methods: */
 void gtk_print_job_set_status (GtkPrintJob   *job,
index 7de8ada7f3d2501156e96a581891a5a1b6c5079b..65cd6ca421bb3a79ac83bfc592f05d24667f30cb 100644 (file)
@@ -844,11 +844,31 @@ _gtk_printer_get_hard_margins (GtkPrinter *printer,
   backend_class->printer_get_hard_margins (printer, top, bottom, left, right);
 }
 
+/**
+ * gtk_printer_get_capabilities:
+ * @printer: a #GtkPrinter
+ * 
+ * Returns the printer's capabilities.
+ *
+ * This is useful when you're using #GtkPrintUnixDialog's manual-capabilities setting
+ * and need to know which settings the printer can handle and which you must
+ * handle yourself.
+ *
+ * This will return 0 unless the printer's details are available, see
+ * gtk_printer_has_details() and gtk_printer_request_details().
+ *  *
+ * Return value: the printer's capabilities
+ *
+ * Since: 2.12
+ */
 GtkPrintCapabilities
-_gtk_printer_get_capabilities (GtkPrinter *printer)
+gtk_printer_get_capabilities (GtkPrinter *printer)
 {
-  GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
+  GtkPrintBackendClass *backend_class;
 
+  g_return_val_if_fail (GTK_IS_PRINTER (printer), 0);
+
+  backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
   return backend_class->printer_get_capabilities (printer);
 }
 
@@ -1050,6 +1070,31 @@ gtk_enumerate_printers (GtkPrinterFunc func,
     }
 }
 
+GType
+gtk_print_capabilities_get_type (void)
+{
+  static GType etype = 0;
+
+  if (G_UNLIKELY (etype == 0))
+    {
+      static const GFlagsValue values[] = {
+        { GTK_PRINT_CAPABILITY_PAGE_SET, "GTK_PRINT_CAPABILITY_PAGE_SET", "page-set" },
+        { GTK_PRINT_CAPABILITY_COPIES, "GTK_PRINT_CAPABILITY_COPIES", "copies" },
+        { GTK_PRINT_CAPABILITY_COLLATE, "GTK_PRINT_CAPABILITY_COLLATE", "collate" },
+        { GTK_PRINT_CAPABILITY_REVERSE, "GTK_PRINT_CAPABILITY_REVERSE", "reverse" },
+        { GTK_PRINT_CAPABILITY_SCALE, "GTK_PRINT_CAPABILITY_SCALE", "scale" },
+        { GTK_PRINT_CAPABILITY_GENERATE_PDF, "GTK_PRINT_CAPABILITY_GENERATE_PDF", "generate-pdf" },
+        { GTK_PRINT_CAPABILITY_GENERATE_PS, "GTK_PRINT_CAPABILITY_GENERATE_PS", "generate-ps" },
+        { GTK_PRINT_CAPABILITY_PREVIEW, "GTK_PRINT_CAPABILITY_PREVIEW", "preview" },
+        { 0, NULL, NULL }
+      };
+
+      etype = g_flags_register_static (I_("GtkPrintCapabilities"), values);
+    }
+
+  return etype;
+}
+
 
 #define __GTK_PRINTER_C__
 #include "gtkaliasdef.c"
index 69865e418a38766f39ef5ff6b0e048301dd8f470..4c14d21bb9aec01d6ea217ef52a3af910feff5c4 100644 (file)
@@ -33,6 +33,21 @@ G_BEGIN_DECLS
 #define GTK_IS_PRINTER_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINTER))
 #define GTK_PRINTER_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINTER, GtkPrinterClass))
 
+/* Note, this type is manually registered with GObject in gtkprinter.c
+ * If you add any flags, update the registration as well!
+ */
+typedef enum
+{
+  GTK_PRINT_CAPABILITY_PAGE_SET     = 1 << 0,
+  GTK_PRINT_CAPABILITY_COPIES       = 1 << 1,
+  GTK_PRINT_CAPABILITY_COLLATE      = 1 << 2,
+  GTK_PRINT_CAPABILITY_REVERSE      = 1 << 3,
+  GTK_PRINT_CAPABILITY_SCALE        = 1 << 4,
+  GTK_PRINT_CAPABILITY_GENERATE_PDF = 1 << 5,
+  GTK_PRINT_CAPABILITY_GENERATE_PS  = 1 << 6,
+  GTK_PRINT_CAPABILITY_PREVIEW      = 1 << 7
+} GtkPrintCapabilities;
+
 typedef struct _GtkPrinter          GtkPrinter;
 typedef struct _GtkPrinterClass     GtkPrinterClass;
 typedef struct _GtkPrinterPrivate   GtkPrinterPrivate;
@@ -84,6 +99,7 @@ gint                     gtk_printer_compare           (GtkPrinter *a,
                                                        GtkPrinter *b);
 gboolean                 gtk_printer_has_details       (GtkPrinter       *printer);
 void                     gtk_printer_request_details   (GtkPrinter       *printer);
+GtkPrintCapabilities     gtk_printer_get_capabilities  (GtkPrinter       *printer);
 
 typedef gboolean (*GtkPrinterFunc) (GtkPrinter *printer,
                                    gpointer    data);
index 17167c47f86053416de4b442aab167e5aa174603..b18af88a1c910f83a08b89608f486f92395331a2 100644 (file)
@@ -1283,7 +1283,7 @@ selected_printer_changed (GtkTreeSelection   *selection,
 
   if (printer != NULL)
     {
-      priv->printer_capabilities = _gtk_printer_get_capabilities (printer);
+      priv->printer_capabilities = gtk_printer_get_capabilities (printer);
       priv->options = _gtk_printer_get_options (printer, 
                                                priv->initial_settings,
                                                priv->page_setup,